function [peef,freqs]=makeFreqPlot(xBin,xPred,samprate,freqs,bandwidth)

if nargin<4
    freqs=linspace(3,45,(45-3)*2+1);
end
if nargin<5
    bandwidth=1;
end
nfreqs=numel(freqs);
% for LFPRegion=1:5
    for f=1:nfreqs
freq=freqs(f);
filtfreq=freq/samprate*2; % Filter out 60Hz Signal
filtbw=bandwidth./(samprate/2); % 1Hz Bandwidth
[filtb,filta]=iirpeak(filtfreq,filtbw);
xtmp=filtfilt(filtb,filta,xBin);
xpredtmp=filtfilt(filtb,filta,xPred);
ble(f,:)=sum(xtmp.^2);
pre(f,:)=sum((xtmp-xpredtmp).^2);


    end
peef=(ble-pre)./ble;
%     T(:,:,LFPRegion)=peef;
% colormap hot
% % colormap(b2r(0,3))
% imagesc(peef,[0,max(peef(:))]),a=colorbar;
% lab=freqs(1:10:end);
%     set(gca,'FontSize',20,'ytick',linspace(0,numel(freqs),numel(lab)),'yticklabel',round(lab*10)/10)
%     set(gca,'xtick',linspace(0,numBins,11),'xticklabel',0:4:40);
%     xlabel('Minute')
%     ylabel('Frequency, \it Hz')
%     title(sprintf('%d %s Cells predicting the %s Region',maxCells,regions{NeuronRegion},regions{LFPRegion}))
%     ylabel(a,'Reduction in Variance')
%     drawnow
%     print('-dpdf',sprintf('dynfreq%s%s%d',regions{NeuronRegion},regions{LFPRegion},maxCells));
%     pause
% end